﻿using System;
using Abp.Domain.Entities.Auditing;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using FwProject.Core.Restaurant;
using FwProject.Core.FactoryInfo;
using System.Collections.Generic;
using FwProject.Core.Car;
using Newtonsoft.Json;
namespace FwProject.Core.Distribution
{
    /// <summary>
    /// 配送对象
    /// </summary>
    [Table("DistributionInfo")]
    public class DistributionInfo : FullAuditedEntity<Guid>
    {
        /// <summary>
        /// 工厂编号
        /// </summary>
        public Guid? FactoryinfoId { get; set; }
        /// <summary>
        /// 餐厅编号
        /// </summary>
        /// <value>The restaurantid.</value>
        public Guid? Restaurantid { get; set; }

        [ForeignKey("Restaurantid")]
        public virtual RestaurantInfo RestaurantInfoModel { get; set; }
        /// <summary>
        /// 汽车编号
        /// </summary>
        /// <value>The carinfoid.</value>
        [Display(Name = "汽车编号")]
        public Guid? Carinfoid { get; set; }
        /// <summary>
        /// 汽车模型
        /// </summary>
        [ForeignKey("Carinfoid")]
        public CarInfo CarInfoModel { get; set; }

        [Display(Name = "配送单号")]
        public string CreationNumber { get; set; }
        public Pricestatus Pricestatus { get; set; } = Pricestatus.已配送;
        /// <summary>
        /// 总的结账金额
        /// </summary>
        /// <value>The total price.</value>
        public decimal TotalPrice { get; set; } = 0;

        /// <summary>
        /// 装车编号
        /// </summary>
        public Guid? LoadCarId { get; set; }
        [ForeignKey("LoadCarId")]
        public virtual LoadCar LoadCarModel { get; set; }
        /// <summary>
        /// 结账编号
        /// </summary>
        /// <value>The settlement identifier.</value>
        public Guid? SettlementId { get; set; }

        public virtual ICollection<DistributionInfoDetails> DistributionInfoListDetails { get; set; }

        /// <summary>
        /// 店存数
        /// </summary>
        public int Stock { get; set; } = 0;
        /// <summary>
        /// 配送店存
        /// </summary>
        public int DistributionStock { get; set; } = 0;
    }
    public enum Pricestatus
    {
        已配送 = 0,
        未结账 = 1,
        已结账 = 2,
        已制单 = 3,
        制单退回 = 4
    }
}
